package org.dromara.product.controller;

import lombok.extern.slf4j.Slf4j;
import org.dromara.product.bean.Product;
import org.dromara.product.service.ProductService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/product")
@Slf4j
public class ProductController {
    @Autowired
    ProductService productService;
    @GetMapping("/{id}")
    public Product getProduct(@PathVariable("id") Long productId) {
        log.info("查询商品信息，id:{}", productId);
        Product productById = productService.getProductById(productId);
        return productById;
    }
}
